package cn.itcast.zt.java8.model.proxy.self;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 创建开关方法类,实现开关方法接口,重写run方法,实现执行指定方法的逻辑(这里使用到了反射)
 * create by zhangtian105 on 2021/9/15
 */
public class SwitchFunction implements ISwitchFunction{
    @Override
    public Object run(Method method, Object obj, Object... arg) throws InvocationTargetException, IllegalAccessException {
        return method.invoke(obj, arg);
    }
}
